package com.dwd.org.pojo;

import com.dwd.basic.pojo.BaseBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: TODO
 * @Author 汶狄
 * @Date 2021/1/5 10:47
 * @Version 1.0
 * @ApiModel 类注释
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@ApiModel("部门实体类")
public class Department extends BaseBean {

    /**
     * 部门编号
     */
    @ApiModelProperty("部门编号")
    private String sn;
    /**
     * 部门名称
     */
    @ApiModelProperty("部门名称")
    private String name;

    /**
     * 部门状态 0 正常 1 停用
     */
    @ApiModelProperty("部门状态 0 正常 1 停用")
    private Integer state;
    /**
     * 上级部门路径
     */
    private String dirPath;
    /**
     * 部门经理 和员工关联
     */
    private Employee manager;
    /**
     * 上级部门
     */
    private Department parent;
    /**
     * 子部门
     */
    private List<Department> children = new ArrayList<>();

    /**
     * 对应前台属性
     *
     * @return
     */
    public Long getValue() {
        return this.id;
    }

    /**
     * 对应的值
     *
     * @return
     */
    public String getLabel() {
        return this.name;
    }

    public Department(String sn, String name, Integer state) {
        this.sn = sn;
        this.name = name;
        this.state = state;
    }

    public Department(Long id) {
        this.id = id;
    }
}
